package task;

import java.sql.*;

import database.Database;


public class TaskCleaner implements TaskState, Runnable {

	@Override
	public void run() {
		
		try {
			
			Connection connection = Database.getConnection();
			PreparedStatement pstmt = connection.prepareStatement(
								"delete from `task` where state = " + DELETED);

			while (true) {
				
				Thread.sleep(3600000);
				pstmt.executeUpdate();
			}
		} catch (InterruptedException | SQLException e) {
			// TODO: handle exception
		}
		
	}
	
}
